package com.sunwayworld.baseline.feishu.util;


import org.springframework.context.annotation.Bean;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName FeishuCheckUtils
 * @Author zhoujq
 * @Date 2022/8/4
 * @Version 1.0
 **/
public class FeishuCheckUtils {
    private FeishuCheckUtils() {

    }

    static final FeishuCheckUtils feishuCheckUtils = new FeishuCheckUtils();

    public static FeishuCheckUtils getInstance() {
        return feishuCheckUtils;
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate(this.simpleClientHttpRequestFactory());
    }

//    @Bean
    public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setReadTimeout(5000);
        factory.setConnectTimeout(15000);
        // 设置代理
        //factory.setProxy(null);
        return factory;
    }
}
